#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

int countSetbits(int num)
{
    int count = 0;
    while (num > 0) {
	count++;
        num = num&(num-1);
    }
    return count;
}


int main(int argc, char **argv)
{
    cout << countSetbits(2) <<endl;
    cout << countSetbits(4) <<endl;
    cout << countSetbits(13) <<endl;
}
